package com.wj.tool.common.utils.paging;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import java.io.Serializable;
import java.util.Objects;

public class Paging implements Serializable {
    private static final long serialVersionUID = 3862532812976510098L;
    @Max(
            value = 200L,
            message = "每页设置显示数量最大不能超过200"
    )
    @Min(
            value = 1L,
            message = "每页设置显示数量最小值位1"
    )
    private int pageSize;
    @Max(2147483647L)
    @Min(
            value = 0L,
            message = "当前页数值不能为负"
    )
    private int pageNumber;
    @Max(2147483647L)
    @Min(
            value = 0L,
            message = "总页数值不能为负"
    )
    private int totalPages;
    @Max(2147483647L)
    @Min(
            value = 0L,
            message = "记录总数值不能为负"
    )
    private int totalNumber;

    public Paging() {
    }

    public int getPageSize() {
        return this.pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageNumber() {
        return this.pageNumber;
    }

    public void setPageNumber(int pageNumber) {
        this.pageNumber = pageNumber;
    }

    public int getTotalPages() {
        return this.totalPages;
    }

    public void setTotalPages(int totalPages) {
        this.totalPages = totalPages;
    }

    public int getTotalNumber() {
        return this.totalNumber;
    }

    public void setTotalNumber(int totalNumber) {
        this.totalNumber = totalNumber;
    }

    public boolean equals(Object o) {
        if (this == o) {
            return true;
        } else if (o != null && this.getClass() == o.getClass()) {
            Paging paging = (Paging)o;
            return this.pageSize == paging.pageSize && this.pageNumber == paging.pageNumber && this.totalPages == paging.totalPages && this.totalNumber == paging.totalNumber;
        } else {
            return false;
        }
    }

    public int hashCode() {
        return Objects.hash(new Object[]{this.pageSize, this.pageNumber, this.totalPages, this.totalNumber});
    }

    public String toString() {
        return "Paging{pageSize=" + this.pageSize + ", pageNumber=" + this.pageNumber + ", totalPages=" + this.totalPages + ", totalNumber=" + this.totalNumber + '}';
    }
}